<!--

    Copyright (c) 2012, Mayocat <hello@mayocat.org>

    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.

-->
<div class="loading" ng-show="loading"></div>

<div ng-show="!!createNewTenant">

</div>

<div>
    <table class="table table-hover tenants" ng-show="tenants.length > 0">
        <thead>
        <tr>
            <th>Tenant</th>
            <th>Created on</th>
            <th>Links</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="tenant in tenants" ng-style="{'border-left': '3px solid ' + stringToHexColor(tenant.slug)}">
            <td ng-click="setRoute('/tenants/' + tenant.slug)">
                <div>
                    <h4>{{tenant.name}}</h4>
                    <small>{{tenant.slug}}</small>
                </div>
            </td>
            <td>
                {{tenant.creationDate | iso8601toLocalDate:'LLL'}}
            </td>
            <td>
                <a href="http://{{tenant.slug}}.{{domain}}/admin/" target="_new">Back-office</a> -
                <a href="http://{{tenant.slug}}.{{domain}}/" target="_new">Front-office</a>
            </td>

            </td>
        </tr>
        </tbody>

    </table>

    <div class="pagination">
        <ul>
            <li>
                <a ng-class="{'not-a-link': currentPage == 1}" ng-click="gotoPage(1)">First</a>
            </li>
            <li ng-repeat="page in pages">
                <a ng-bind="page.number" ng-click="gotoPage(page.number)" ng-class="{'not-a-link': currentPage == page.number}"></a>
            </li>
            <li>
                <a ng-class="{'not-a-link': currentPage == totalPages}" ng-click="gotoPage(totalPages)">Last</a>
            </li>
        </ul>
    </div>

</div>